#ifndef _SYSAPP_STATUSBAR_H_
#define _SYSAPP_STATUSBAR_H_

#include "entry/EasyUIContext.h"
#include "app/SysAppFactory.h"

#include "uart/ProtocolData.h"
#include "uart/ProtocolParser.h"

#include "utils/Log.h"
#include "control/ZKDigitalClock.h"
#include "control/ZKButton.h"
#include "control/ZKCircleBar.h"
#include "control/ZKDiagram.h"
#include "control/ZKListView.h"
#include "control/ZKPointer.h"
#include "control/ZKQRCode.h"
#include "control/ZKTextView.h"
#include "control/ZKSeekBar.h"
#include "control/ZKEditText.h"
#include "control/ZKVideoView.h"
#include "window/ZKSlideWindow.h"
/*TAG:Macro宏ID*/
#define ID_STATUSBAR_WinSub    110006
#define ID_STATUSBAR_order    50036
#define ID_STATUSBAR_Sub_item    50042
#define ID_STATUSBAR_Main_item    50035
#define ID_STATUSBAR_ButtonRight    20004
#define ID_STATUSBAR_ButtonLeft    20003
#define ID_STATUSBAR_ButtonDown    20002
#define ID_STATUSBAR_ButtonUp    20001
#define ID_STATUSBAR_ListViewBar    80003
#define ID_STATUSBAR_WinMenu    110004
#define ID_STATUSBAR_BurshRotational    50033
#define ID_STATUSBAR_Speed    50047
#define ID_STATUSBAR_line    50030
#define ID_STATUSBAR_speedUnit    50048
#define ID_STATUSBAR_WinSpeed    110002
#define ID_STATUSBAR_TextLogo    50034
#define ID_STATUSBAR_Bottombg    50028
#define ID_STATUSBAR_shiningGear    50027
#define ID_STATUSBAR_TextView3    50024
#define ID_STATUSBAR_range    50049
#define ID_STATUSBAR_oilIcon    50057
#define ID_STATUSBAR_WinFuel    110011
#define ID_STATUSBAR_TextView4    50023
#define ID_STATUSBAR_tempIcon    50058
#define ID_STATUSBAR_WinCoolant    110005
#define ID_STATUSBAR_gear    50022
#define ID_STATUSBAR_mileageTotal    50016
#define ID_STATUSBAR_gearRank    50006
#define ID_STATUSBAR_compass    50009
#define ID_STATUSBAR_TextView1    50001
#define ID_STATUSBAR_WD4LOW    50020
#define ID_STATUSBAR_ECO    50018
#define ID_STATUSBAR_discharge    50015
#define ID_STATUSBAR_AUTO    50013
#define ID_STATUSBAR_SERV    50012
#define ID_STATUSBAR_LOCK    50010
#define ID_STATUSBAR_NEUTRAL    50005
#define ID_STATUSBAR_Oil_temperature    50011
#define ID_STATUSBAR_braking    50032
#define ID_STATUSBAR_Low_oil_leve    50031
#define ID_STATUSBAR_GeneratorBattery    50017
#define ID_STATUSBAR_steeringSystem    50029
#define ID_STATUSBAR_failure    50025
#define ID_STATUSBAR_Electronic_throttle    50014
#define ID_STATUSBAR_Automatic    50021
#define ID_STATUSBAR_Trailer_malfunction    50008
#define ID_STATUSBAR_Cleaning_liquid    50007
#define ID_STATUSBAR_ascend_descend    50004
#define ID_STATUSBAR_Fuel_tank    50003
#define ID_STATUSBAR_OIL_PRESSURE    50002
#define ID_STATUSBAR_Antifreeze    50026
#define ID_STATUSBAR_TextFault    50019
#define ID_STATUSBAR_WinFault    110001
#define ID_STATUSBAR_TextDoorRR    50040
#define ID_STATUSBAR_TextDoorRL    50039
#define ID_STATUSBAR_TextDoorFR    50038
#define ID_STATUSBAR_TextDoorFL    50037
#define ID_STATUSBAR_CarDoor    50041
#define ID_STATUSBAR_WindowCarDoor    110003
/*TAG:Macro宏ID END*/
class statusbar : public BaseApp,
                  public ZKSeekBar::ISeekBarChangeListener, 
                  public ZKListView::IItemClickListener,
                  public ZKListView::AbsListAdapter,
                  public ZKSlideWindow::ISlideItemClickListener,
                  public EasyUIContext::ITouchListener,
                  public ZKEditText::ITextChangeListener,
                  public ZKVideoView::IVideoPlayerMessageListener
{
public:
	statusbar();
	virtual ~statusbar();
	virtual void onCreate();
	virtual void onClick(ZKBase *pBase);
	virtual bool onTimer(int id);

    virtual void onProgressChanged(ZKSeekBar *pSeekBar, int progress);

    virtual int getListItemCount(const ZKListView *pListView) const;
    virtual void obtainListItemData(ZKListView *pListView, ZKListView::ZKListItem *pListItem, int index);
    virtual void onItemClick(ZKListView *pListView, int index, int subItemIndex);

    virtual void onSlideItemClick(ZKSlideWindow *pSlideWindow, int index);

    virtual bool onTouchEvent(const MotionEvent &ev);

    virtual void onTextChanged(ZKTextView *pTextView, const string &text);

    void rigesterActivityTimer();

    virtual void onVideoPlayerMessage(ZKVideoView *pVideoView, int msg);
    void videoLoopPlayback(ZKVideoView *pVideoView, int msg, size_t callbackTabIndex);
    void startVideoLoopPlayback();
    void stopVideoLoopPlayback();
    bool parseVideoFileList(const char *pFileListPath, std::vector<string>& mediaFileList);
    int removeCharFromString(string& nString, char c);

    /**
     * 注册定时器
     */
	void registerUserTimer(int id, int time);
	/**
	 * 取消定时器
	 */
	void unregisterUserTimer(int id);
	/**
	 * 重置定时器
	 */
	void resetUserTimer(int id, int time);

protected:
    /*TAG:PROTECTED_FUNCTION*/
	virtual const char* getAppName() const;


private:
    /*TAG:PRIVATE_VARIABLE*/
    int mVideoLoopIndex;
    int mVideoLoopErrorCount;
};

#endif